<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd">

  <context:property-placeholder location="classpath:db.properties"/>
  <bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="packagesToScan">
      <list>
        <value>${basePackage}</value>
      </list>
    </property>
    <property name="hibernateProperties">
      <props>
        <prop key="hibernate.dialect"><#if schema=="MySQL">org.hibernate.dialect.MySQL5Dialect</#if><#if schema=="ORACLE">
          org.hibernate.dialect.Oracle10gDialect</#if></prop>
      </props>
    </property>
  </bean>

  <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="${r'${jdbc.driverClassName}'}"/>
    <property name="url" value="${r'${jdbc.url}'}"/>
    <property name="username" value="${r'${jdbc.username}'}"/>
    <property name="password" value="${r'${jdbc.password}'}"/>
  </bean>

  <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
  </bean>

</beans>